﻿'Description:不合格信息记录类
'Copyright (c) : 通力凯顿（北京）系统集成有限公司
'Writer:Wangjh
'create Date:2017-4-13
'Rewriter:
'Rewrite Date:
Imports System.Text
Imports DatabaseAccess.DBUtility
Imports System.Data.OracleClient
Imports BusinessRule.DTO

Public Class uLMSUnqualifiedBusiness
    Implements IBusiness.uLMSUnqualifiedIBusiness

    ''' <summary>
    ''' 插入数据到不合格信息表
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function InsertUnqualifiedData(ByVal para As System.Collections.Generic.Dictionary(Of String, String)) As Boolean Implements IBusiness.uLMSUnqualifiedIBusiness.InsertUnqualifiedData
        Dim strsql As New StringBuilder 'add StepInfoID
        Dim count As Integer
        strsql.AppendLine("INSERT INTO ContainerNonconformingInfo(ZBHGLB,ZSLDW,ZLJLB,ZZRDW2,QMCOD,  MATNR,FERTAUFNR,ZMESGX, " &
                       " ZMESGXTXT ,UVORN,ZLTXA1,ZLPH2,ZPCH2,ZJX2,ZJGS,ZBHGPS,ZBC,ZGD2," &
                       " ZCLPH2,QMGRP,ZZTTXT,POSNR, FEGRP,FECOD,FETXT,ZQXTXT,EmployeeID,CreateDate," &
                      " IsUse,IsIntegration,ContainerNonconformingInfoId,CONTAINERID,WORKFLOWSTEPID,ISTRANSFER")
        If para.ContainsKey("StepInfoID") Then
            strsql.AppendLine(",StepInfoID")
        End If
        strsql.AppendLine(")")
        strsql.AppendLine("values (:UnqualifiedCategory,:TrialUnit,:PartCategory,:DutyUnit," &
                        " :EncodeCode,:MaterialNoData,:ProductionOrderNumData,:MesSpecData,:MesSpecDescData," &
                       " :ChildSpecData,:ChildSpecDescData,:StoveBatchNumData,:MachineBatchNumData,:TypeData," &
                      " :MachineTotalNumData,:UnqualifiedNumData,:VersionNoData,:WorkCenterData,:MaterialBrandNumData," &
                     " :CodeCodeGroupsData,:DefectsTextData,:DefectsOrderNoData,:DefectsCodeGroupsData,:DefectsCodeData," &
                    " :DefectsShortTxtData,:DefectsLongTxtData,:ApplicantId,sysDate,0,1,:ContainerNonconformingInfoId,:ContainerID,:WorkFlowStepID,0")

        If para.ContainsKey("StepInfoID") Then
            strsql.AppendLine(",:StepInfoID")
            count = 30
        Else
            count = 29
        End If
        strsql.AppendLine(")")
        Dim insertParam(count) As OracleParameter

        'modify tianfw 2017/10/10
        insertParam(0) = DatabaseHelper.NewParameter(":UnqualifiedCategory", para("UnqualifiedCategory"), OracleType.VarChar)
        insertParam(1) = DatabaseHelper.NewParameter(":TrialUnit", para("TrialUnit"), OracleType.VarChar)
        insertParam(2) = DatabaseHelper.NewParameter(":PartCategory", para("PartCategory"), OracleType.VarChar)
        insertParam(3) = DatabaseHelper.NewParameter(":DutyUnit", para("DutyUnit"), OracleType.VarChar)
        insertParam(4) = DatabaseHelper.NewParameter(":EncodeCode", para("EncodeCode"), OracleType.VarChar)
        insertParam(5) = DatabaseHelper.NewParameter(":MaterialNoData", para("MaterialNoData"), OracleType.VarChar)
        insertParam(6) = DatabaseHelper.NewParameter(":ProductionOrderNumData", para("ProductionOrderNumData"), OracleType.VarChar)
        insertParam(7) = DatabaseHelper.NewParameter(":MesSpecData", para("MesSpecData"), OracleType.VarChar)
        insertParam(8) = DatabaseHelper.NewParameter(":MesSpecDescData", para("MesSpecDescData"), OracleType.VarChar)
        insertParam(9) = DatabaseHelper.NewParameter(":ChildSpecData", para("ChildSpecData"), OracleType.VarChar)
        insertParam(10) = DatabaseHelper.NewParameter(":ChildSpecDescData", para("ChildSpecDescData"), OracleType.VarChar)
        insertParam(11) = DatabaseHelper.NewParameter(":StoveBatchNumData", para("StoveBatchNumData"), OracleType.VarChar)
        insertParam(12) = DatabaseHelper.NewParameter(":MachineBatchNumData", para("MachineBatchNumData"), OracleType.VarChar)
        insertParam(13) = DatabaseHelper.NewParameter(":TypeData", para("TypeData"), OracleType.VarChar)
        insertParam(14) = DatabaseHelper.NewParameter(":MachineTotalNumData", para("MachineTotalNumData"), OracleType.VarChar)
        insertParam(15) = DatabaseHelper.NewParameter(":UnqualifiedNumData", para("UnqualifiedNumData"), OracleType.VarChar)
        insertParam(16) = DatabaseHelper.NewParameter(":VersionNoData", para("VersionNoData"), OracleType.VarChar)
        insertParam(17) = DatabaseHelper.NewParameter(":WorkCenterData", para("WorkCenterData"), OracleType.VarChar)
        insertParam(18) = DatabaseHelper.NewParameter(":MaterialBrandNumData", para("MaterialBrandNumData"), OracleType.VarChar)
        insertParam(19) = DatabaseHelper.NewParameter(":CodeCodeGroupsData", para("CodeCodeGroupsData"), OracleType.VarChar)
        insertParam(20) = DatabaseHelper.NewParameter(":DefectsTextData", para("DefectsTextData"), OracleType.VarChar)
        insertParam(21) = DatabaseHelper.NewParameter(":DefectsOrderNoData", para("DefectsOrderNoData"), OracleType.VarChar)
        insertParam(22) = DatabaseHelper.NewParameter(":DefectsCodeGroupsData", para("DefectsCodeGroupsData"), OracleType.VarChar)
        insertParam(23) = DatabaseHelper.NewParameter(":DefectsCodeData", para("DefectsCodeData"), OracleType.VarChar)
        insertParam(24) = DatabaseHelper.NewParameter(":DefectsShortTxtData", para("DefectsShortTxtData"), OracleType.VarChar)
        insertParam(25) = DatabaseHelper.NewParameter(":DefectsLongTxtData", para("DefectsLongTxtData"), OracleType.VarChar)
        insertParam(26) = DatabaseHelper.NewParameter(":ApplicantId", para("ApplicantId"), OracleType.VarChar)
        insertParam(27) = DatabaseHelper.NewParameter(":ContainerNonconformingInfoId", para("ContainerNonconformingInfoId"), OracleType.VarChar)
        '
        insertParam(28) = DatabaseHelper.NewParameter(":CONTAINERID", para("ContainerID"), OracleType.VarChar)
        insertParam(29) = DatabaseHelper.NewParameter(":WORKFLOWSTEPID", para("WorkflowStepID"), OracleType.VarChar)
        'add YangJiang 20180523
        If para.ContainsKey("StepInfoID") Then
            insertParam(30) = DatabaseHelper.NewParameter(":StepInfoID", para("StepInfoID"), OracleType.VarChar)
        End If


        If DatabaseHelper.ExecuteSql(strsql.ToString, insertParam) > 0 Then
            InsertUnqualifiedData = True
            Exit Function
        End If
        InsertUnqualifiedData = False

    End Function

    ''' <summary>
    ''' 获取不合格品信息
    ''' create tianFW
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetUnqualifiedInfo(ByVal para As Dictionary(Of String, String)) As uMESProcessResult Implements IBusiness.uLMSUnqualifiedIBusiness.GetUnqualifiedInfo
        Dim strsql As New StringBuilder

        strsql.AppendLine("SELECT C.CONTAINERNONCONFORMINGINFOID,C.ZPCH2,C.ZMESGX,C.ZJGS,C.ZBHGPS,C.CREATEDATE,C.MATNR,C.FERTAUFNR,C.ZMESGXTXT,C.ZBHGLB,C.ZZRDW2,C.ZGD2,C.UVORN,C.ZLTXA1,co.containertype," &
            " C.ZSLDW,C.ZLPH2,C.ZLJLB,C.ZJX2,C.ZBC,C.ZCLPH2,C.QMGRP,C.QMCOD,C.ZZTTXT,C.POSNR,C.FEGRP,C.FECOD,C.FETXT,C.ZQXTXT,C.QMNUM,C.ZBHGDH,C.ZJYBH,C.ZYWLPC2,C.ZSFGL,C.ZSLJL,C.ZBZ2,EM.FULLNAME," &
            " C.CONTAINERID,C.WORKFLOWSTEPID,CO.WORKFLOWID,C.ACCEPTANCEQTY,C.LOSSQTY,CO.CONTAINERNAME,NVL(CO.NONCONFORMINGNUM,0) NONCONFORMINGNUM,CO.QTY,CO.WORKFLOWSTEPSEQUENCE SEQUENCE " &
            " FROM CONTAINERNONCONFORMINGINFO C " &
            " LEFT JOIN CONTAINERCURRENTINFO CO ON CO.CONTAINERID = C.CONTAINERID AND CO.WORKFLOWSTEPID = C.WORKFLOWSTEPID AND CO.CONTAINERID IS NOT NULL" &
            " LEFT JOIN EMPLOYEE EM ON EM.EMPLOYEEID = C.EMPLOYEEID")
        strsql.AppendLine("WHERE C.ISUSE=0")
        If para("Status") = "1" Then
            strsql.AppendLine("AND C.CHECKEMPLOYEEID IS NULL")
        ElseIf para("Status") = "2" Then
            strsql.AppendLine("AND C.CHECKEMPLOYEEID IS NOT NULL")
        End If
        If para.Keys.Contains("ProductName") Then
            strsql.AppendFormat(" AND C.MATNR LIKE '%{0}%'", para("ProductName"))
        End If
        If para.Keys.Contains("ScanContainerName") Then
            strsql.AppendFormat(" AND C.ZPCH2 = '{0}'", para("ScanContainerName"))
        Else
            If para.Keys.Contains("ContainerName") Then
                strsql.AppendFormat(" AND C.ZPCH2 LIKE '%{0}%'", para("ContainerName"))
            End If
        End If
        If para.Keys.Contains("mfgOrderName") Then
            strsql.AppendFormat(" AND CO.MFGORDERNAME LIKE '%{0}%'", para("mfgOrderName"))
        End If
        If para.Keys.Contains("WorkflowStepName") Then
            strsql.AppendFormat(" AND C.ZMESGX LIKE '%{0}%'", para("WorkflowStepName"))
        End If
        If para.Keys.Contains("BeginDate") Then
            strsql.AppendFormat(" AND C.CREATEDATE >TO_DATE('{0}','YYYY/MM/DD HH24:MI:SS')", Date.Parse(para("BeginDate")))
        End If
        If para.Keys.Contains("EndDate") Then
            strsql.AppendFormat(" AND C.CREATEDATE <TO_DATE('{0}','YYYY/MM/DD HH24:MI:SS')", Date.Parse(para("EndDate")))
        End If
        strsql.AppendFormat(" AND CO.FACTORYID='{0}'", para("FactoryID"))
        Dim paraPage As New uMESPagingDataDTO
        paraPage.CurrentPageIndex = Convert.ToInt32(para("CurrentPageIndex"))
        paraPage.PageSize = Convert.ToInt32(para("PageSize").ToString)
        paraPage.strSQL = strsql.ToString
        Dim result As uMESProcessResult = DatabaseHelper.RunProcedureForPage(paraPage)
        Return result
    End Function

    ''' <summary>
    ''' 更新不合格品审理信息
    ''' create tianFW
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function updateUnqualifiedInfo(ByVal para As Dictionary(Of String, String)) As Boolean Implements IBusiness.uLMSUnqualifiedIBusiness.updateUnqualifiedInfo
        updateUnqualifiedInfo = False
        Dim strsql As String =
            <string>
                UPDATE ContainerNonconformingInfo SET QMNUM=:QMNUM,ZBHGDH=:ZBHGDH,ZJYBH=:ZJYBH,ZYWLPC2=:ZYWLPC2,ZSFGL=:ZSFGL,ZSLJL=:ZSLJL,ZBZ2=:ZBZ2,ACCEPTANCEQTY=:ACCEPTANCEQTY,
                LOSSQTY=:LOSSQTY,CHECKDATE=SYSDATE,CHECKEMPLOYEEID=:CHECKEMPLOYEEID,ISTRANSFER=0 WHERE CONTAINERNONCONFORMINGINFOID=:CONTAINERNONCONFORMINGINFOID
            </string>
        Dim insertpara(10) As OracleParameter
        'modify 2017/10/10
        insertpara(0) = DatabaseHelper.NewParameter(":QMNUM", para("QMNUM"), OracleType.VarChar)
        insertpara(1) = DatabaseHelper.NewParameter(":ZBHGDH", para("ZBHGDH"), OracleType.VarChar)
        insertpara(2) = DatabaseHelper.NewParameter(":ZJYBH", para("ZJYBH"), OracleType.VarChar)
        insertpara(3) = DatabaseHelper.NewParameter(":ZYWLPC2", para("ZYWLPC2"), OracleType.VarChar)
        insertpara(4) = DatabaseHelper.NewParameter(":ZSFGL", para("ZSFGL"), OracleType.VarChar)
        insertpara(5) = DatabaseHelper.NewParameter(":ZSLJL", para("ZSLJL"), OracleType.VarChar)
        insertpara(6) = DatabaseHelper.NewParameter(":ZBZ2", para("ZBZ2"), OracleType.VarChar)
        insertpara(7) = DatabaseHelper.NewParameter(":ACCEPTANCEQTY", para("ACCEPTANCEQTY"), OracleType.VarChar)
        insertpara(8) = DatabaseHelper.NewParameter(":LOSSQTY", para("LOSSQTY"), OracleType.VarChar)
        insertpara(9) = DatabaseHelper.NewParameter(":CHECKEMPLOYEEID", para("CHECKEMPLOYEEID"), OracleType.VarChar)
        insertpara(10) = DatabaseHelper.NewParameter(":CONTAINERNONCONFORMINGINFOID", para("CONTAINERNONCONFORMINGINFOID"), OracleType.VarChar)
        '
        Dim row As Integer = DatabaseHelper.ExecuteSql(strsql, insertpara)
        If row > 0 Then
            updateUnqualifiedInfo = True
        End If
    End Function

    ''' <summary>
    ''' 获取批次已检总数 由待检改为已检
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetNeedCheckQty(ByVal para As Dictionary(Of String, String)) As DataTable Implements IBusiness.uLMSUnqualifiedIBusiness.GetNeedCheckQty
        Dim strsql As New StringBuilder
        strsql.AppendLine(" SELECT SUM(CSW.QTY) QTY, CSW.CONTAINERID FROM CONTAINERSTEPWORKREPORT CSW" &
                                      " LEFT JOIN CONTAINERCHECKINFO CCI ON CCI.CONTAINERSTEPWORKREPORTID = CSW.CONTAINERSTEPWORKREPORTID" &
                                      " AND CCI.ISUSE = 0 WHERE CSW.ISUSE = 0 AND CCI.CONTAINERCHECKINFOID IS NOT NULL")
        strsql.AppendFormat(" AND CSW.CONTAINERID ='{0}'", para("ContainerID"))
        strsql.AppendFormat(" AND CSW.WORKFLOWSTEPID ='{0}'", para("WorkFlowStepID"))
        strsql.AppendLine("GROUP BY CSW.CONTAINERID")
        Dim dt As DataTable = DatabaseHelper.Query_ReturnDatTable(strsql.ToString)
        Return dt
    End Function

    ''' <summary>
    ''' 根据批次id获取该批次的所有不合格品记录
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetContainerNonconformingInfo(ByVal containerID As String) As DataTable Implements IBusiness.uLMSUnqualifiedIBusiness.GetContainerNonconformingInfo
        Dim strsql As String = String.Format("SELECT ZBHGDH FROM CONTAINERNONCONFORMINGINFO C WHERE C.CONTAINERID = '{0}' AND C.ISUSE=0 ", containerID)
        Return DatabaseHelper.Query_ReturnDatTable(strsql)
    End Function

    ''' <summary>
    ''' 根据不合格品唯一ID删除不合格品
    ''' </summary>
    ''' <param name="containerNonconformingInfoID"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function DelContainerNonconformingInfo(ByVal containerNonconformingInfoID As String) As Boolean Implements IBusiness.uLMSUnqualifiedIBusiness.DelContainerNonconformingInfo
        Dim strsql As String = String.Format("UPDATE CONTAINERNONCONFORMINGINFO C SET C.ISUSE=1 WHERE C.CONTAINERNONCONFORMINGINFOID = '{0}' ", containerNonconformingInfoID)
        If DatabaseHelper.ExecuteSql(strsql) > 0 Then
            Return True
        Else
            Return False
        End If
    End Function

    ''' <summary>
    ''' 获取不合格品记录，主页显示 add YangJiang 20180425
    ''' modify by tianFW 2018年10月18日 提交人和检验人员查询  c.employeeid 和 createdate(不是CHECKEMPLOYEEID和CHECKDATE),将containername 修改为查询containerno
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetUnqualifiedMainView(ByVal para As System.Collections.Generic.Dictionary(Of String, String)) As System.Data.DataTable Implements IBusiness.uLMSUnqualifiedIBusiness.GetUnqualifiedMainView
        Dim strSQL As String =
            <string>
                SELECT NVL(cci.workflowroute,CCI.PRODUCTNAME) productname,CCI.CONTAINERNO,NVL(cci.workflowroute,CCI.PRODUCTNAME)||'/'||cci.containerno containername,C.ZBHGPS,sum(CCI.QTY) qty,C.ZMESGX,E.FULLNAME,C.CHECKDATE
                FROM CONTAINERCURRENTINFO CCI
                INNER JOIN CONTAINERNONCONFORMINGINFO C ON C.CONTAINERID=CCI.CONTAINERID AND C.WORKFLOWSTEPID=CCI.WORKFLOWSTEPID
                LEFT JOIN EMPLOYEE E ON E.EMPLOYEEID=C.CHECKEMPLOYEEID WHERE C.ISUSE=0
            </string>
        strSQL += " AND CCI.FACTORYID='" & para("FactoryID") & "'"
        If para.Keys.Contains("WorkcenterID") Then
            strSQL += " AND CCI.WORKCENTERID='" & para("WorkcenterID") & "'"
        End If
        If para.Keys.Contains("TeamID") Then
            strSQL += " AND CCI.TEAMID='" & para("TeamID") & "'"
        End If
        strSQL += <string>GROUP BY cci.workflowroute,CCI.PRODUCTNAME,CCI.CONTAINERNO,C.ZBHGPS,CCI.QTY,C.ZMESGX,E.FULLNAME,C.CHECKDATE</string>.Value
        GetUnqualifiedMainView = DatabaseHelper.Query_ReturnDatTable(strSQL)
    End Function

    ''' <summary>
    ''' 获取不合格品信息
    ''' create Yuxj20180413
    ''' Modify by Yuxj20181011   LEFT JOIN container c1 ON c.zpch2=c1.containername-->LEFT JOIN container c1 ON c.containerid=c1.containerid
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetZSUnqualifiedInfo(ByVal para As Dictionary(Of String, String)) As uMESProcessResult Implements IBusiness.uLMSUnqualifiedIBusiness.GetZSUnqualifiedInfo
        Dim strsql As New StringBuilder
        'modify YangJiang 20180523 sb.stepinfoname StepInfoName,s.stepinfoid,e1.fullname checker
        strsql.AppendLine("SELECT C.CONTAINERNONCONFORMINGINFOID,C.ZPCH2,C.ZMESGX,C.ZJGS,C.ZBHGPS,C.CREATEDATE,C.MATNR,C.FERTAUFNR,C.ZMESGXTXT,C.ZBHGLB,C.ZZRDW2,C.ZGD2,C.UVORN,C.ZLTXA1," &
            " C.ZSLDW,C.ZLPH2,C.ZLJLB,C.ZJX2,C.ZBC,C.ZCLPH2,C.QMGRP,C.QMCOD,C.ZZTTXT,C.POSNR,C.FEGRP,C.FECOD,C.FETXT,C.ZQXTXT,C.QMNUM,C.ZBHGDH,C.ZJYBH,C.ZYWLPC2,C.ZSFGL,C.ZSLJL,C.ZBZ2,EM.FULLNAME," &
            " C.CONTAINERID,C.WORKFLOWSTEPID,C.ACCEPTANCEQTY,C.LOSSQTY, " &
            "  c1.containername,c1.togetherflag,u.attributevalue machinename,m.mfgordername,sb.stepinfoname StepInfoName,s.stepinfoid,e1.fullname checker " &
            " FROM CONTAINERNONCONFORMINGINFO C " &
            "  LEFT JOIN container c1 ON c.containerid=c1.containerid" &
            "  LEFT JOIN mfgorder m ON c1.mfgorderid=m.mfgorderid  " &
            " LEFT JOIN Userattribute u ON c1.mfgorderid=u.parentid AND u.userattributename='发动机'  " &
            " LEFT JOIN EMPLOYEE EM ON EM.EMPLOYEEID = C.EMPLOYEEID")
        strsql.AppendLine(" LEFT JOIN stepinfo s ON s.stepinfoid=c.stepinfoid") 'add YangJiang 20180523
        strsql.AppendLine(" LEFT JOIN stepinfobase sb ON sb.stepinfobaseid=s.stepinfobaseid") 'add YangJiang 20180523
        strsql.AppendLine(" LEFT JOIN employee e1 ON e1.employeeid=c.checkemployeeid") 'add YangJiang 20180523
        strsql.AppendLine("WHERE C.ISUSE=0")
        If para("Status") = "1" Then
            strsql.AppendLine("AND C.CHECKEMPLOYEEID IS NULL")
        ElseIf para("Status") = "2" Then
            strsql.AppendLine("AND C.CHECKEMPLOYEEID IS NOT NULL")
        End If
        If para.Keys.Contains("ProductName") Then
            strsql.AppendFormat(" AND C.MATNR LIKE '%{0}%'", para("ProductName"))
        End If
        If para.Keys.Contains("ScanContainerName") Then
            strsql.AppendFormat(" AND C.ZPCH2 = '{0}'", para("ScanContainerName"))
        Else
            If para.Keys.Contains("ContainerName") Then
                strsql.AppendFormat(" AND C.ZPCH2 LIKE '%{0}%'", para("ContainerName"))
            End If
        End If
        If para.Keys.Contains("mfgOrderName") Then
            strsql.AppendFormat(" AND m.MFGORDERNAME LIKE '%{0}%'", para("mfgOrderName"))
        End If
        If para.Keys.Contains("WorkflowStepName") Then
            strsql.AppendFormat(" AND C.ZMESGX LIKE '%{0}%'", para("WorkflowStepName"))
        End If
        If para.Keys.Contains("BeginDate") Then
            strsql.AppendFormat(" AND C.CREATEDATE >TO_DATE('{0}','YYYY/MM/DD HH24:MI:SS')", Date.Parse(para("BeginDate")))
        End If
        If para.Keys.Contains("EndDate") Then
            strsql.AppendFormat(" AND C.CREATEDATE <TO_DATE('{0}','YYYY/MM/DD HH24:MI:SS')", Date.Parse(para("EndDate")))
        End If
        strsql.AppendFormat(" AND m.FACTORYID='{0}'", para("FactoryID"))
        Dim paraPage As New uMESPagingDataDTO
        paraPage.CurrentPageIndex = Convert.ToInt32(para("CurrentPageIndex"))
        paraPage.PageSize = Convert.ToInt32(para("PageSize").ToString)
        paraPage.strSQL = strsql.ToString
        Dim result As uMESProcessResult = DatabaseHelper.RunProcedureForPage(paraPage)
        Return result
    End Function

    ''' <summary>
    ''' 更新批次不合格品标识
    ''' </summary>
    ''' <param name="containerID">批次ID</param>
    ''' <param name="type">不合格品标识 1是 0否 </param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function UpdateNonConformingNum(ByVal containerID As String, ByVal type As Integer) As Boolean Implements IBusiness.uLMSUnqualifiedIBusiness.UpdateNonConformingNum
        UpdateNonConformingNum = False
        Dim strsql As New StringBuilder
        strsql.AppendFormat("UPDATE CONTAINERCURRENTINFO CU SET CU.NONCONFORMINGNUM = {0} WHERE CU.CONTAINERID ='{1}'", type, containerID)
        If Not DatabaseHelper.ExecuteSql(strsql.ToString()) > 0 Then
            Exit Function
        End If
        UpdateNonConformingNum = True
    End Function
End Class
